#if !defined(E2E_NET_H_)
#define E2E_NET_H_

#include "common/basic_type.h"
#include "common/perception_defs.h"
#include "nvidia/trt_infer.h"

namespace autodrive {
namespace perception {
class E2ENet {
 public:
  E2ENet();
  E2ENet(E2ENet &&) = delete;
  E2ENet(const E2ENet &) = delete;
  E2ENet &operator=(E2ENet &&) = delete;
  E2ENet &operator=(const E2ENet &) = delete;
  virtual ~E2ENet();

 public:
  struct E2ENetSettings {
    /// @brief tensorrt infer settings
    TrtInfer::TrtInferSettings trt_infer_settings;
  };

 public:
  /// @brief init flag
  /// @return true/false
  bool IsInit() const noexcept { return is_init_; }
  /// @brief get settings
  /// @return E2ENetSettings
  E2ENetSettings const &Settings() const noexcept { return settings_; }

  /// @brief
  /// @param settings
  void Init(E2ENetSettings const &settings) noexcept(false);

  /// @brief
  /// @param calibDataSetPtr
  /// @param result
  void Run(PerceptionResult &result) noexcept(false);

  /// @brief  close
  void Close() noexcept;

 private:
  /// @brief init flag
  bool is_init_;
  /// @brief  init call once flag
  mutable std::once_flag init_flag_;

  E2ENetSettings settings_;
  /// @brief infer engine
  TrtInfer infer_engine_;
};

}  // namespace perception
}  // namespace autodrive

#endif  // E2E_NET_H_
